package com.qf.controller;

import com.qf.dto.DataGridResult;
import com.qf.dto.QueryDTO;
import com.qf.log.MyLog;
import com.qf.service.SysMenuService;
import com.qf.utils.R;
import com.qf.utils.ShiroUtils;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;
import java.util.Map;

/**
 * @author Zhengjz
 * @version 1.0
 * @className SysMenuController
 * @date 2021/1/27 15:00
 */
@Controller
public class SysMenuController {

    @Autowired
    private SysMenuService sysMenuService;


    @MyLog("菜单列表")
    @RequestMapping("/sys/menu/list")
    @ResponseBody
    @RequiresPermissions("sys:menu:list")
    public DataGridResult findMenu(QueryDTO queryDTO){
        return sysMenuService.findMenu(queryDTO);
    }




    @RequestMapping("/sys/menu/user")
    @ResponseBody
    public R userMenu(){
        long userId = ShiroUtils.getUserId();
        return sysMenuService.findUserMenu(userId);
    }
}
